<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Dashboard extends CI_Controller {

    public $render_data;

    function __construct() {
        parent::__construct();

        $this->load->library('template');
        $this->template->set_template('backend');
        $this->load->library('carabiner');
        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        //$this->load->model('backend/backend_dashboard_model', 'backend_dash');
        /*
         * check admin and return session data
         */
        if (!is_loggedin()) {
            redirect($this->router->reverseRoute('backend_login') . '?redirect=' . base64_encode(current_url()));
        }
    }

    function index() {
        
        // Google Analytics //
        $this->load->helper('gapi');
        $this->load->config('analytic');
        $this->render_data['ga'] = new gapi($this->config->item('ga_username'),$this->config->item('ga_password'));
        
        $this->template->write_view('side_menu','backend/side_menu');
        $this->template->write_view('content', 'backend/dashboard', $this->render_data);
        $this->template->render();
    }

}